package com.itheima.Servlet01;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/servletdemo01")
public class ServletDemo01<webServlet> extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       //获取虚拟目录
        String contextPath = req.getContextPath();
        String servletPath = req.getServletPath();//获取servlet的映射目录
        String remoteAddr = req.getRemoteAddr();//获取访问者的id
        String requestURI = req.getRequestURI();//获取同意资源标识符  虚拟目录+映射目录
        StringBuffer requestURL = req.getRequestURL();//获取统一资源定位符 浏览器的访问路径
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
